﻿<%@ Page Title="Cidades por Polo" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="CadastroCidadePolo.aspx.cs" Inherits="AcadPosApp.Cadastros.CadastroCidadePolo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style3
        {
        }
        .style5
        {
            width: 305px;
        }
        .style8
        {
            width: 407px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="pnlPesquisa" runat="server" GroupingText="Consultas de Cidades por Polo">
        <table class="style1">
            <tr>
                <td class="style5">
                    Estado
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style5">
                    <asp:DropDownList ID="ddlEstadoPesquisa" runat="server" OnSelectedIndexChanged="ddlEstadoPesquisa_SelectedIndexChanged"
                        Width="150px" AutoPostBack="True" AppendDataBoundItems="True">
                        <asp:ListItem Selected="True" Value="0">SELECIONE</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style5">
                    Polo
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style5">
                    <asp:DropDownList ID="ddlPoloPesquisa" runat="server" Enabled="False" 
                        Width="400px">
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;
                    <asp:Button ID="btnConsultar" runat="server" formnovalidate="formnovalidate" Text="Consultar"
                        ValidationGroup="pesquisa" OnClick="btnConsultar_Click" Width="100px" />
                </td>
            </tr>
        </table>
        <br />
        <asp:GridView ID="gvwPesquisa" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
            DataKeyNames="ID_CIDADE_POLO" EmptyDataText="Dados não localizados..." GridLines="Vertical"
            OnRowCommand="gvwPesquisa_RowCommand" Width="45%" OnRowCreated="gvwPesquisa_RowCreated"
            OnRowDataBound="gvwPesquisa_RowDataBound" AllowPaging="True" 
            OnPageIndexChanging="gvwPesquisa_PageIndexChanging">
            <AlternatingRowStyle BackColor="#D3D3D3" />
            <Columns>
                 <%--<asp:ButtonField ButtonType="Image" CommandName="Alterar" ImageUrl="~/Imagens/edit.png"
                    Text="Button" HeaderText="Alterar" >
                    <ItemStyle  Width="20px"/>
                    </asp:ButtonField>  --%>
                <asp:TemplateField HeaderText="Editar" ShowHeader="False">
                    <ItemTemplate>
                        <abbr >
                            <asp:ImageButton ID="ImgAlterar" runat="server" CausesValidation="false" CommandName="Alterar"
                                formnovalidate="formnovalidate" ImageUrl="~/Imagens/edit.png" Text="Alterar"
                                Width="20px" />
                        </abbr>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Excluir" ShowHeader="False">
                    <ItemTemplate>
                        <abbr title="Excluir">
                            <asp:ImageButton ID="Excluir" formnovalidate="formnovalidate" runat="server" CausesValidation="false"
                                OnClientClick="return ShowConfirm('Tem certeza que deseja excluir?', this.ID);"
                                CommandName="Excluir" ImageUrl="~/Imagens/delete.png" Text="Excluir" Width="20px"/>
                        </abbr>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:TemplateField>
                <asp:BoundField DataField="NOME_CIDADE" HeaderText="Cidade">
                    <ItemStyle HorizontalAlign="Left" Width="65%" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Status">
                    <ItemTemplate>
                        <asp:Image ID="imgStatus" runat="server" Height="25px" Width="25px" />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:TemplateField>
                <asp:BoundField DataField="SITUACAO" HeaderText="Situação">
                    <ItemStyle Width="10%" HorizontalAlign="Center" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>
        <br />
        &nbsp;&nbsp;
        <asp:Button ID="btnInserir" runat="server" Text="Inserir" 
            formnovalidate="formnovalidate" onclick="btnInserir_Click" Width="100px" /><br /><br />
    </asp:Panel>
    <br />
    <asp:Panel ID="pnlCadastro" GroupingText="Cadastro de Cidades por Polo" runat="server"
        Visible="False">
        <table class="style1">
            <tr>
                <td class="style8">
                    Estado
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style8">
                    <asp:DropDownList ID="ddlCadEstado" runat="server" Width="150px" 
                        AutoPostBack="True" 
                        onselectedindexchanged="ddlCadEstado_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style8">
                    Polo
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style8">
                    <asp:DropDownList ID="ddlCadPolo" runat="server" Enabled="False" Width="400px">
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style8">
                    Cidade
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style8">
                    <asp:TextBox ID="txtCadCidade" runat="server" required MaxLength="50" 
                        Width="400px"></asp:TextBox>
                </td>
                <td>
                    <asp:Button ID="btnConsultaCidade" runat="server" formnovalidate="formnovalidate"
                        OnClick="btnConsultaCidade_Click" Text="Consultar" 
                        ValidationGroup="consultaCidade" Width="100px" />
                </td>
            </tr>
            <tr>
                <td class="style3" colspan="2">
                    <asp:GridView ID="gvwCidade" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
                        DataKeyNames="ID_CIDADE" 
                        EmptyDataText="A cidade pesquisada não existe ou já foi alocada a outro polo!" GridLines="Vertical"
                        Width="45%">
                        <AlternatingRowStyle BackColor="#D3D3D3" />
                        <Columns>
                            <asp:CommandField ButtonType="Image" SelectImageUrl="~/Imagens/select.png" ShowSelectButton="True" />
                            <asp:BoundField DataField="NOME_CIDADE" HeaderText="Cidade">
                                <ItemStyle HorizontalAlign="Left" Width="99%" />
                            </asp:BoundField>
                        </Columns>
                        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                        <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
                        <SortedAscendingCellStyle BackColor="#F1F1F1" />
                        <SortedAscendingHeaderStyle BackColor="#808080" />
                        <SortedDescendingCellStyle BackColor="#CAC9C9" />
                        <SortedDescendingHeaderStyle BackColor="#383838" />
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td class="style8">
                    Situacão
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style8">
                    <asp:DropDownList ID="ddlSituacao" runat="server" Width="150px">
                        <asp:ListItem Value="A">Ativo</asp:ListItem>
                        <asp:ListItem Value="I">Inativo</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
        <br />
        <div class="legenda">
            <asp:Button ID="btnConfirmar" runat="server" Text="Confirmar" 
                ValidationGroup="cadastro" onclick="btnConfirmar_Click" Width="100px" />
            &nbsp;<asp:Button ID="btnCancelar" formnovalidate="formnovalidate" runat="server" 
                Text="Cancelar" onclick="btnCancelar_Click" Width="100px" />
        </div><br />
    </asp:Panel>
</asp:Content>
